module.exports = function (trace) {
  function getTextByCode (code) {
    let message = code
    switch (code) {
      case 'PermissionDenied':
        message = '无访问权限'
        break
      default:
    }
    return message
  }

  function toast (message) {
    console.log(getTextByCode(message), trace)
  }

  if (Object.prototype.toString.call(trace) === '[object Error]') {
    console.error(trace)
    toast(trace.toString())
    return
  }

  if (typeof trace === 'string') {
    toast(trace)
    return
  }

  if (Object.prototype.hasOwnProperty.call(trace, 'toString')) {
    toast(trace.toString())
    return
  }

  toast(trace)
}
